package com.psd.demo.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.pds.demo.dao.OrganizationDao;
import com.pds.demo.dao.impl.OrganizationDaoImpl;
import com.pds.mvc.ActionForward;
import com.pds.mvc.Actions;
import com.psd.demo.model.Department;

public class DelEmpListServlet extends Actions {

	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {

		// 告诉服务器，对表单进行中文解码
		response.setContentType("text/html;charset=utf-8");
		// 接受前台的参数
		Integer id = Integer.parseInt(request.getParameter("id"));
		OrganizationDao dao = new OrganizationDaoImpl();
		try {
			int count = dao.DeleteEmp(id);
			if (count > 0) {
				return new ActionForward("emplist.action", true);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new ActionForward("./error.jsp", true);
	}

}
